<style>
    .topimg{width:100%; height:50px; margin:0 auto}
    .topimg a img{width:100%; height:50px; margin:0 auto; border:0px}
</style>
<div class="topimg">
    <a href="https://www.baidu.com">
        <img src="__STATICHOME__/images/topimg.jpg" width="1024" height="50">
    </a>
</div>
<div id="header" class="new_header">
    <div class="hd_bar">
        <div class="bd_bar_bd cle">
            <ul class="welcome">
                <li><a id="favorite_wb" href="javascript:;" rel="nofollow">收藏FD商城</a></li>
                <?php $user_session = session(C('FRONT_SESSION'))?>
                <li id="ECS_MEMBERZONE">
                    <empty name="user_session">
                        <a href="{:U('login/login')}" rel="nofollow">请登录</a>
                        <s>|</s>
                        <a href="{:U('login/register')}" rel="nofollow">免费注册</a>
                        <else />
                        <a href="{:U('Member/index')}" class="">{$user_session['account']}</a>
                        &nbsp;[
                        <a href="{:U('login/login_out')}">退出</a>
                        ]
                    </empty>

                </li>
            </ul>
            <ul id="userinfo-bar">
                <li class="more-menu">
                    <a href="{:U('Member/index')}">会员中心</a>
                    <i class="iconfont arrow"> </i>
                    <div class="more-bd">
                        <div class="list">
                            <a href="http://m36.ys.tstxflash.com/user.php?act=order_list">我的订单</a>
                            <a href="http://m36.ys.tstxflash.com/user.php?act=comment_list">我的评价</a>
                            <a href="http://m36.ys.tstxflash.com/user.php?act=account_log">我的余额</a>
                            <a href="http://m36.ys.tstxflash.com/user.php?act=bonus">我的红包</a>
                            <a href="http://m36.ys.tstxflash.com/user.php?act=collection_list">我的收藏</a>
                            <a href="http://m36.ys.tstxflash.com/user.php?act=address_list" class="last">修改收货地址</a>
                        </div>
                    </div>
                </li>
                <li><a href="#">
                    <i class="iconfont vipico"></i>
                    手机版
                </a>
                </li>
            </ul>
        </div>
    </div>
    <script type="text/javascript">

        <!--
        function checkSearchForm()
        {
            if(document.getElementById('keyword').value)
            {
                return true;
            }
            else
            {
                alert("请输入搜索关键词！");
                return false;
            }
        }
        -->

    </script>
    <div class="hd_main cle">
        <div class="logo">
            <a href="/" class="lizi_logo">
                <img src="__STATICHOME__/images/logo.jpg" alt="FD商城">
            </a>
        </div>
        <div class="search_box">
            <form action="http://m36.ys.tstxflash.com/search.php" method="get" id="searchForm" name="searchForm" onsubmit="return checkSearchForm()">
                <input class="sea_input" type="text" name="keywords" id="keyword" value="" autocomplete="off">
                <input type="hidden" value="k1" name="dataBi">
                <button type="submit" class="sea_submit">搜索</button>
            </form>
        </div>
        <div class="head_search_hot"> <span>热搜榜：</span>  <a href="http://m36.ys.tstxflash.com/search.php?keywords=%E5%AE%A0%E7%89%A9%E7%8B%97%E7%B2%AE" target="_blank">宠物狗粮</a>  <a href="http://m36.ys.tstxflash.com/search.php?keywords=%E9%B8%9F%E7%AC%BC%EF%BC%8C%E7%A3%A8%E7%89%99%E6%A3%92" target="_blank">鸟笼，磨牙棒</a>  <a href="http://m36.ys.tstxflash.com/search.php?keywords=%E5%9B%BD%E4%BA%A7%E6%96%99" target="_blank">国产料</a>  <a href="http://m36.ys.tstxflash.com/search.php?keywords=%E9%81%9B%E7%8B%97%E7%BB%B3" target="_blank">遛狗绳</a>  </div>
        <div class="intro">
            <ul>
                <li class="no1"><a href="javascript:void(0);" target="_blank">
                    <h4>正品保障</h4>
                    <p>100%正品低价</p>
                </a></li>
                <li class="no2"><a href="javascript:void(0);" target="_blank">
                    <h4>30天退换货</h4>
                    <p>购物有保障</p>
                </a></li>
                <li class="no3"><a href="javascript:void(0);" target="_blank">
                    <h4>满99就包邮</h4>
                    <p>闪电发货</p>
                </a></li>
            </ul>
        </div>
    </div>
    <div class="hd_nav">
        <div class="hd_nav_bd cle">
            <div class="main_nav" id="main_nav">
                <div class="main_nav_link">
                    <a href="javascript:;">全部商品分类</a>
                    <i class="iconfont"></i>
                </div>
                <div class="main_cata" id="J_mainCata" style="opacity: 0; display: none;">
                    <ul>
                        <foreach name="classification_info" item="v" >
                            <li>
                                <h3>
                                    <a href="{:U('Classification/lists')}?id={$v.id}">{$v.classification}</a>
                                </h3>
                            </li>
                        </foreach>
                    </ul>
                </div>
                <div class="J_subCata" id="J_subCata" style="opacity: 0; left: 213px; top: 35px;">
                    <php>
                        foreach($classification_info as $v){
                        echo '<div class="J_subView" style="display: none;">';
                        foreach($v['_data'] as $vv){
                        echo '<dl><dt><a href="/Classification/lists?id='.$vv['id'].'">'.$vv['classification'].'</a></dt><dd>';
                            foreach($vv['_data'] as $vvv){
                            echo '<a href="/Classification/lists?id='.$vvv['id'].'">'.$vvv['classification'].'</a>';
                            }
                            echo '</dd></dl><div class="clear"></div>';
                        }
                        echo '</div>';
                        }
                    </php>
                </div>
            </div>
            <ul class="sub_nav cle" id="sub_nav">
                <li class="current">
                    <a href="/" rel="nofollow">首页</a>
                </li>
                <volist name="classification_info" id="v">
                    <li>
                        <a href="{:U('classification/lists')}?id={$v.id}" rel="nofollow">{$v.classification}</a>
                    </li>
                </volist>
                <li>
                    <a href="#" rel="nofollow">积分兑换</a>
                </li>
            </ul>
            <?php
                if(empty(session(C('FRONT_SESSION')))){
                    if(isset($_COOKIE['fd_goods'])){
                        $goods = $_COOKIE['fd_goods'];
                        $cart_goods = unserialize($goods);
                    }else{
                        $cart_goods = array();
                    }
                }else{
                    $cart_goods = M('cart')->where(['mid'=>session(C('FRONT_SESSION'))['id']])->select();
                }
                $cart_count = 0;
                $all_price = 0.00;
                foreach($cart_goods as $v){
                    $cart_count +=  $v['num'];
                    $all_price += $v['subtotal'];
                }
            ?>
            <div class="hd_cart" id="ECS_CARTINFO">
                <a class="tit" href="{:U('Cart/cart')}">
                    <b class="iconfont">Ɲ</b>去购物车结算
                    <span>
                        <i class="iconfont"></i>
                    </span>
                    <em class="num" id="hd_cartnum" style="visibility: visible;">{$cart_count}</em>
                </a>
                <div class="list">
                    <empty name="cart_count">
                        <p class="fail" style="display:none;">
                            <i class="iconfont">ŭ</i>
                            <br>
                            购物车空啦<br>
                            爱Ta，就带Ta来购物车吧
                        </p>
                        <else />
                        <div class="data">
                            <foreach name="cart_goods" item="v">
                                <dl>
                                    <dt>
                                        <a target="_blank" href="{:U('Goods/detail')}?id={$v.goods_id}">
                                            <img src="{$v.litimg}">
                                        </a>
                                    </dt>
                                    <dd>
                                        <h4><a target="_blank" href="{:U('Goods/detail')}?id={$v.goods_id}">{$v.goods_name}</a></h4>
                                        <p><span class="red">{$v.fd_price}</span>&nbsp;<i>X</i>&nbsp;{$v.num}</p>
                                        <a class="iconfont del" title="删除" href="javascript:deleteCartGoods({$v['goods_id']})">Ť</a>
                                    </dd>
                                </dl>
                            </foreach>
                            <div class="count">共<span class="red" id="hd_cart_count">{$cart_count}</span>件商品哦~
                                <p>总价:
                                    <span class="red">
                                        <em id="hd_cart_total">{$all_price}</em>
                                    </span>
                                    <a href="{:U('Cart/check_out')}" class="btn">去结算</a>
                                </p>
                            </div>
                        </div>
                    </empty>
                </div>
                <script type="text/javascript">
                    function deleteCartGoods(rec_id)
                    {
                        Ajax.call('/Cart/out_cart', 'id='+rec_id, deleteCartGoodsResponse, 'POST', 'JSON');
                    }

                    /**
                     * 接收返回的信息
                     */
                    function deleteCartGoodsResponse(res)
                    {
                        if (res.error)
                        {
                            alert(res.err_msg);
                        }
                        else
                        {
                            alert(res.msg);
                            window.location.reload();
                        }
                    }
                </script>
            </div>
        </div>
    </div>
    <div class="search_result"></div>
</div>
